package com.common.android.utils;

import org.xmlpull.v1.XmlPullParser;

import android.text.TextUtils;

/**
 * XML相关类
 * <br>Created 2014-8-25 下午4:52:25
 * @version  
 * @author   huangyx		
 * @see 	 
 * Copyright(c) 2009-2014, TQ Digital Entertainment, All Rights Reserved
 */
public class XMLUtils {
    
    /**
     * 从XML里面读int型数据
     * <br>Created 2014-1-16下午9:25:23
     * @param xmlPull XML解析器
     * @param key key值
     * @return int型数据
     * @author       cb
     */
    public static int getIntFromXml(XmlPullParser xmlPull,String key){
        int result=0;
        String value=xmlPull.getAttributeValue("", key);
        if (!TextUtils.isEmpty(value)){
            try {
                result=Integer.parseInt(value);     
            } catch (NumberFormatException e) {
                e.printStackTrace();
            }
        }
        return result;
    }
}
